{template 'public/header'}
{template 'public/comhead'}
<link rel="stylesheet" type="text/css" href="../addons/zh_gjw/template/public/ygcsslist.css">
<style type="text/css">
    .yg5_key>div{float: left;line-height: 34px;}
    .store_td1{height: 45px;}
    .store_list_img{width: 60px;height: 60px;}
    .yg5_tabel{border-color: #e5e5e5;outline: 1px solid #e5e5e5;}
    .yg5_tr2>td{padding: 10px 15px;border: 1px solid #e5e5e5;text-align:center;}
    .yg5_tr1>th{
        border: 1px solid #e5e5e5;
        padding-left: 15px;
        background-color: #FAFAFA;
        font-weight: bold;
        text-align: center;
    }
    .yg5_btn{background-color: #EEEEEE;color: #333;border: 1px solid #E4E4E4;border-radius: 6px;width: 100px;height: 34px;}
    /*#frame-2{display: block;visibility: visible;}*/
</style>
<ul class="nav nav-tabs">
    <span class="ygxian"></span>
    <div class="ygdangq">当前位置:</div>    
    <li class="active"><a href="{php echo $this->createWebUrl('primanage');}">帖子列表</a></li>
    <li><a href="{php echo $this->createWebUrl('prishset');}">帖子审核设置</a></li>
</ul>
<ul class="nav nav-tabs">
    <li   {if $activep==1} class="active" {/if}><a href="{php echo $this->createWebUrl('primanage',array('pay'=>1));}">未付款</a></li>
    <li   {if $activep==2} class="active" {/if}><a href="{php echo $this->createWebUrl('primanage',array('pay'=>2));}">已付款</a></li>
    <li   {if $activep==3} class="active" {/if}><a href="{php echo $this->createWebUrl('primanage',array('pay'=>3));}">已退款</a></li>
    {if $shset['prishset']==1}
    <li   {if $active==1} class="active" {/if}><a href="{php echo $this->createWebUrl('primanage',array('state'=>1));}">还未审核</a></li>
    <li   {if $active==2} class="active" {/if}><a href="{php echo $this->createWebUrl('primanage',array('state'=>2));}">审核通过</a></li>
    <li   {if $active==3} class="active" {/if}><a href="{php echo $this->createWebUrl('primanage',array('state'=>3));}">审核被拒</a></li>
    {/if}
</ul>
<div class="main">
        <div class="panel panel-default">
            <div class="panel-body">
                <form action="" method="get" class="col-md-4">
                    <input type="hidden" name="c" value="site" />
                    <input type="hidden" name="a" value="entry" />
                    <input type="hidden" name="m" value="zh_gjw" />
                    <input type="hidden" name="do" value="primanage" />
                    <div class="input-group" style="width: 300px">
                        <input type="text" name="keywords" class="form-control" placeholder="请输入标题\手机号">
                        <span class="input-group-btn">
                    <input type="submit" class="btn btn-default" style="padding: 7.5px 12px" name="submit" value="查找"/>
                </span>
                    </div>
                    <input type="hidden" name="token" value="{$_W['token']}"/>
                    <input type="hidden" name="type" value="all"/>
                </form>
            </div>
        </div>
    <div class="panel panel-default">
        <div class="panel-heading">
            定制管理&nbsp;>&nbsp;帖子管理&nbsp;>&nbsp;帖子列表
        </div>
        <div class="panel-heading">
            <button type="button" id="allselect"><i>批量删除</i></button>
            {if $shset['prishset']==1}
            <button type="button" id="allselecty"><i>批量审核</i></button>
            <button type="button" id="allselectn"><i>批量拒审</i></button>
            {/if}
        </div>
        <div class="panel-body" style="padding: 0px 15px;">
            <div class="row">
                <table class="yg5_tabel col-md-12">
                    <tr class="yg5_tr1" style="height: 60px">   
                        <th class="col-md-1">
                            <input type="checkbox" class="allcheck" />
                            <span class="store_inp">全选</span>
                        </th>                 
                        <th class="col-md-1">标题</th>     
                        <th class="col-md-1">电话</th>
                        <th class="col-md-1">付款状态</th>   
                        <th class="col-md-1">推荐状态</th> 
                        <th class="col-md-1">置顶状态</th>  
                        {if $shset['prishset']==1}
                        <th class="col-md-1">审核状态</th>
                        {/if}
                        <th class="col-md-1">创建时间</th>
                        <th class="col-md-2">操作</th>
                    </tr>
                    {loop $notes $row}
                    <tr class="yg5_tr2">
                        <td><input type="checkbox" name="test" value="{$row['id']}"></td>
                        <td>{$row['title']}</td>
                        <td>{$row['phone']}</td>
                        {if $row['pay']==2}
                            <td><a class="btn storegreen btn-xs">已付款</a></td> 
                            {elseif $row['pay']==1}
                            <td><a class="btn storeblue btn-xs">未付款</a></td>
                            {elseif $row['pay']==3}
                            <td><a class="btn storered btn-xs">已退款</a></td>
                        {/if}
                        {if $row['upfee']==1}
                            <td><a class="btn storegreen btn-xs">已付款</a></td> 
                            {elseif $row['upfee']==0}
                            <td><a class="btn storeblue btn-xs">未付款</a></td>
                            {elseif $row['upfee']==2}
                            <td><a class="btn storered btn-xs">已退款</a></td>
                        {/if}
                        {if $row['topfee']==1}
                            <td><a class="btn storegreen btn-xs">已付款</a></td> 
                            {else}
                            <td><a class="btn storeblue btn-xs">未付款</a></td>
                        {/if}
                        {if $shset['prishset']==1}
                            {if $row['state']==2}
                                <td><a class="btn storegreen btn-xs">审核通过</a></td> 
                                {elseif $row['state']==3}
                                <td><a class="btn storered btn-xs">审核被拒</a></td>
                                {elseif $row['state']==1}
                                <td><a class="btn storeblue btn-xs">还未审核</a></td>
                            {/if}
                        {/if}
                        <td>{$row['time']}</td>
                        <td>
                            {if $shset['prishset']==1}
                                {if $row['state']==1}
                                <a href="{php echo $this->createWebUrl('primanage', array('op' => 'tg', 'id' => $row['id']))}"><span class="btn ygyouhui2 btn-xs"  id="btny"><input type="hidden" value="{$row['id']}"><input style="border:none;background:none;" type="button" value="通过"></span></a>
                                <a href="{php echo $this->createWebUrl('primanage', array('op' => 'jj', 'id' => $row['id']))}"><span class="btn ygshouqian2 btn-xs"  id="btny"><input type="hidden" value="{$row['id']}"><input style="border:none;background:none;" type="button" value="拒绝"></span></a>
                                {/if}
                            {/if}
                            <a href="{php echo $this->createWebUrl('prinotedetail', array('id' => $row['id']))}" class="storespan btn btn-xs">
                                <span class="fa">详情页</span>
                                <span class="bianji">详情页<span class="arrowdown"></span>
                                </span>
                            
                            </a>
                            <a href="javascript:void(0);" class="storespan btn btn-xs" data-toggle="modal" data-target="#myModal{$row['id']}">
                                <span class="fa fa-trash-o"></span>
                                <span class="bianji">删除<span class="arrowdown"></span>
                                </span>
                            </a>
                        </td>
                    </tr>
                    <div class="modal fade" id="myModal{$row['id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel" style="font-size: 20px;">提示</h4>
                        </div>
                        <div class="modal-body" style="font-size: 20px">
                            确定删除么？
                        </div>
                        <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <a href="{php echo $this->createWebUrl('primanage', array('op' => 'delete', 'id' => $row['id']))}" type="button" class="btn btn-info" >确定</a>
                        </div>
                    </div>
                </div>
            </div>
            
            
                    {/loop}
                </table>
            </div>
    </div>
    {$pager}
</div>
<script type="text/javascript">
    $(function(){
        $("#frame-4").show();
        $("#yframe-4").addClass("wyactive");
        // $("#frame-2").addClass("in");
        $("#allselect").on('click',function(){
            var check = $("input[type=checkbox][class!=allcheck]:checked");
            if(check.length < 1){
                alert('请选择要删除的帖子!');
                return false;
            }else if(confirm("确认要删除这些帖子?")){
                var id = new Array();
                check.each(function(i){
                    id[i] = $(this).val();
                });
                console.log(id)
                $.ajax({
                    type:"post",
                    url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=Deleteprinote&m=zh_gjw",
                    dataType:"text",
                    data:{id:id},
                    success:function(data){
                        console.log(data);
                        location.reload();
                    }
                })

            }
        });
        $("#allselecty").on('click',function(){
            var check = $("input[type=checkbox][class!=allcheck]:checked");
            if(check.length < 1){
                alert('请选择要审核的帖子!');
                return false;
            }else if(confirm("确认要审核这些帖子?")){
                var id = new Array();
                check.each(function(i){
                    id[i] = $(this).val();
                });
                console.log(id)
                $.ajax({
                    type:"post",
                    url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=Yprinote&m=zh_gjw",
                    dataType:"text",
                    data:{id:id},
                    success:function(data){
                        console.log(data);
                        location.reload();
                    }
                })

            }
        });
        $("#allselectn").on('click',function(){
            var check = $("input[type=checkbox][class!=allcheck]:checked");
            if(check.length < 1){
                alert('请选择要拒审的帖子!');
                return false;
            }else if(confirm("确认要拒审这些帖子?")){
                var id = new Array();
                check.each(function(i){
                    id[i] = $(this).val();
                });
                console.log(id)
                $.ajax({
                    type:"post",
                    url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=Nprinote&m=zh_gjw",
                    dataType:"text",
                    data:{id:id},
                    success:function(data){
                        console.log(data);
                        location.reload();
                    }
                })

            }
        });

        $(".allcheck").on('click',function(){
            var checked = $(this).get(0).checked;
            $("input[type=checkbox]").prop("checked",checked);
        });
    })
</script>